//
//  PigGifRefreshHeader.m
//  PigRefreshDemo
//
//  Created by boom on 2017/5/4.
//  Copyright © 2017年 boomLi. All rights reserved.
//

#import "PigGifRefreshHeader.h"

@implementation PigGifRefreshHeader

- (void)prepare{
    [super prepare];
    
    // 设置普通状态的动画图片
    NSMutableArray *idleImages = [NSMutableArray array];
    for (NSUInteger i = 0; i<6; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"loading%lu", (unsigned long)i]];
        [idleImages addObject:image];
    }
    [self setImages:idleImages forState:MJRefreshStateIdle];
    
    // 设置即将刷新状态的动画图片（一松开就会刷新的状态）
    NSMutableArray *refreshingImages = [NSMutableArray array];
    for (NSUInteger i = 0; i<=5; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"loading%lu", i]];
        [refreshingImages addObject:image];
    }
    [self setImages:refreshingImages forState:MJRefreshStatePulling];
    
    // 设置正在刷新状态的动画图片
    [self setImages:refreshingImages forState:MJRefreshStateRefreshing];
    
    //隐藏时间
    self.lastUpdatedTimeLabel.hidden = YES;
    //隐藏状态
    self.stateLabel.hidden = YES;
}

- (void)placeSubviews{
    [super placeSubviews];
    self.bounds = CGRectMake(0, 0, 375, 60);
    self.gifView.bounds = CGRectMake(0, 0, 30, 30);
}


@end
